print("=======容器通用操作========")

mylist = [2, 1, 3, 0]

# min max len
print(max(mylist))
print(min(mylist))
print(len(mylist))
# for
for x in mylist:
    print(x, " ", end='')
print()
# 排序 sorted
print("排序 sorted")
print(sorted(mylist))
newsorted = sorted(mylist, reverse=True)
print(newsorted)
# 排序 sort
print("排序 sort")
print(mylist)
mylist.sort(reverse=True)
print(mylist)


# 转换
s = str(mylist)
print(type(s))
print(s)
print(str(mylist))
print(list("16fdsf52"))

#list/dict 和 json字符串 之间的转换

import json
print("======列表转字符串========")
data=[{"name":"zzz","age":18},{"name":"abc","age":19}]
print(type(data))
json_str=json.dumps(data)
print(type(json_str))
print(json_str)

print("======字符串转列表========")
s='[{"name":"zzz","age":18},{"name":"abc","age":19}]'
l=json.loads(s)
print(type(l))
print(l)


